package com.fanxuankai.boot.mqbroker.autoconfigure;

import com.fanxuankai.boot.mqbroker.producer.autoconfigure.MqBrokerProducerProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.Collections;
import java.util.List;

/**
 * @author fanxuankai
 */
@ConfigurationProperties(prefix = MqBrokerProperties.PREFIX)
public class MqBrokerProperties {
    public static final String PREFIX = "fxk.mq-broker";
    public static final String DING_TALK_ENABLED = PREFIX + ".ding-talk.enabled";
    /**
     * 钉钉推送参数
     */
    @NestedConfigurationProperty
    private DingTalk dingTalk = new DingTalk();
    /**
     * 应用 id, 用于 canal client 抢占式运行、binlog offset 防重, 默认取 instance
     */
    private String id;
    /**
     * 分组, 用于消费者组隔离
     */
    private String group;
    /**
     * 清理配置
     */
    @NestedConfigurationProperty
    private Clear clear = new Clear();
    /**
     * 外部事件配置，[event: schema]
     * 生产者和消费者不在同一服务的情况下，send、receive 表不在同一个 schema，需要配置 receive 的 schema
     * 用于消息丢失补偿、清理。
     */
    private List<MqBrokerProducerProperties.ExternalEvent> externalEvents = Collections.emptyList();

    public DingTalk getDingTalk() {
        return dingTalk;
    }

    public void setDingTalk(DingTalk dingTalk) {
        this.dingTalk = dingTalk;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public Clear getClear() {
        return clear;
    }

    public void setClear(Clear clear) {
        this.clear = clear;
    }

    public List<MqBrokerProducerProperties.ExternalEvent> getExternalEvents() {
        return externalEvents;
    }

    public void setExternalEvents(List<MqBrokerProducerProperties.ExternalEvent> externalEvents) {
        this.externalEvents = externalEvents;
    }
}
